package service.QuickSort;

import java.util.Comparator;
import java.util.List;

import model.SparePart;

/**
 * 
 * @author Csaba Tarkanyi
 * 
 */
public class QuickSortSparePartBy {

	/**
	 * Sets the Comparator for every SparePart in the List and sorting it using
	 * QuickSort.
	 * 
	 * @param sparePart -
	 *            List of SpareParts.
	 * @param comparator -
	 *            Sets the Comparator for the SpareParts in the List.
	 * 
	 * @author Csaba Tarkanyi
	 */
	public QuickSortSparePartBy(List<SparePart> sparePart,
			Comparator<SparePart> comparator) {
		QuickSort q = new QuickSort();
		for (SparePart a : sparePart) {
			a.setComparator(comparator);
		}
		q.quicksort(sparePart);
	}
}